package com.mysiteforme.admin.service.impl.publish;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.mysiteforme.admin.dao.publish.ElectricitySupplyDao;
import com.mysiteforme.admin.entity.publish.ElectricitySupply;
import com.mysiteforme.admin.service.publish.ElectricitySupplyService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 供需信息表 服务实现类
 * </p>
 *
 * @author wangl
 * @since 2019-09-18
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ElectricitySupplyServiceImpl extends ServiceImpl<ElectricitySupplyDao, ElectricitySupply> implements ElectricitySupplyService {

    @Autowired
    private ElectricitySupplyDao electricitySupplyDao;

    @Override
    public Page<ElectricitySupply> selectSupplyList(Map map) {
        int _page = Integer.valueOf(map.get("page").toString());
        int _limit = Integer.valueOf(map.get("limit").toString());
        List<ElectricitySupply> list = electricitySupplyDao.selectSupplyList(map);
        int count = electricitySupplyDao.selectSupplyCount(map);
        Page<ElectricitySupply> page = new Page<>();
        page.setRecords(list);
        page.setCurrent(_page);
        page.setSize(_limit);
        page.setTotal(count);
        return page;
    }
}
